<template>
  <div class="container">
    
    <div id="qrcode"></div> <!-- 创建一个div，并设置id为qrcode -->
    <div id="code">
      <p>名称：{{this.productNameValue}}</p>
      <p>型号：{{this.productTypeName}}</p>
      <p>项目名称：{{this.productBelongValue}}</p>
    </div>
  </div>
</template>
   
<script>
import QRCode from 'qrcodejs2'  // 引入qrcode
import {getCookie} from '@/utils/cookie'
export default {
  data(){
    return{
      text:'123',
      productNameValue:'',
      productTypeName:'',
      productBelongValue:'',
      productEncoding:'',
      
    }
  },
  mounted () {
    this.qrcode();
    this.productNameValue = getCookie('productNameValue')
    this.productTypeName = getCookie('productTypeName')
    this.productBelongValue = getCookie('productBelongValue')
    this.productEncoding = getCookie('productEncoding')
    this.visible = getCookie('visible')
    console.log('productNameValue',getCookie('productNameValue'))
    console.log('productTypeName',getCookie('productTypeName'))
    console.log('productBelongValue',getCookie('productBelongValue'))
    console.log('productEncoding',getCookie('productEncoding'))
  },
  methods: {
    qrcode() {
      let qrcode = new QRCode('qrcode', {
        width: 132,  
        height: 132,
        text:getCookie('productEncoding') , // 二维码地址
        colorDark : "#000",
        colorLight : "#fff",
      })
    },
     
  }
}
</script>
<style scoped>
.container{
  display: flex;
  text-align: center;
  justify-content: space-around;
}

  
</style>